package com.yeyks.appcontroller;

import com.yeyks.dal.domain.ActivityInfo;
import com.yeyks.model.Ajax.AjaxResponseBody;
import com.yeyks.service.ActivityInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author fuchangshuai
 * @date 2019/4/29 0029
 */
@Api(tags = "活动接口", description = "活动")
@Slf4j
@RestController
@RequestMapping(value = "/app/activity")
public class ActivityInfoContorller {

    @Autowired
    private ActivityInfoService activityInfoService;

    /**
     * 通过活动id获取活动信息
     *
     * @return
     */
    @ApiOperation(value = "通过活动id获取活动信息", notes = "通过活动id获取活动信息")
    @ApiImplicitParam(paramType = "query", name = "id", value = "活动id", required = true, dataType = "int")
    @PostMapping(value = "/info")
    public ResponseEntity<?> info(@RequestParam(name = "id") Integer id) {
        ActivityInfo activityInfo = activityInfoService.info(id);
        return ResponseEntity.ok(AjaxResponseBody.success(activityInfo));
    }

}
